home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / GUIDGEN.PAK / GUIDGEN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  2.9 KB  |  110 lines

  1. // guidgen.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "guidgen.h"
  15. #include "guidgdlg.h"
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CGuidGenApp
  24.  
  25. BEGIN_MESSAGE_MAP(CGuidGenApp, CWinApp)
  26.     //{{AFX_MSG_MAP(CGuidGenApp)
  27.         // NOTE - the ClassWizard will add and remove mapping macros here.
  28.         //    DO NOT EDIT what you see in these blocks of generated code!
  29.     //}}AFX_MSG
  30.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CGuidGenApp construction
  35.  
  36. CGuidGenApp::CGuidGenApp()
  37. {
  38.     // TODO: add construction code here,
  39.     // Place all significant initialization in InitInstance
  40. }
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CGuidGenApp object
  44.  
  45. CGuidGenApp theApp;
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CGuidGenApp initialization
  49.  
  50. BOOL CGuidGenApp::InitInstance()
  51. {
  52.     SetRegistryKey(_T("Microsoft\\MFC 3.0 Samples"));
  53.  
  54.     // Standard initialization
  55.     // If you are not using these features and wish to reduce the size
  56.     //  of your final executable, you should remove from the following
  57.     //  the specific initialization routines you do not need.
  58.  
  59.     Enable3dControls();
  60.  
  61.     if (::CoInitialize(NULL) != S_OK)
  62.     {
  63.         AfxMessageBox(IDP_ERR_INIT_OLE);
  64.         return FALSE;
  65.     }
  66.  
  67.     // process command line arguments
  68.     CWnd* pParentWnd = NULL;
  69.     for (LPCTSTR lpsz = m_lpCmdLine; *lpsz != 0; ++lpsz)
  70.     {
  71.         if (*lpsz != '-' && *lpsz != '/')
  72.             continue;
  73.  
  74.         switch (lpsz[1])
  75.         {
  76.         // "/A" or "/a" allows the window to be parented to the IDE window
  77.         // add GUIDGEN /A to your tools menu for easy access!
  78.         case 'a':
  79.         case 'A':
  80.             pParentWnd = CWnd::GetForegroundWindow();
  81.             break;
  82.         }
  83.     }
  84.  
  85.     CGuidGenDlg dlg(pParentWnd);
  86.     m_pMainWnd = &dlg;
  87.     int nResponse = dlg.DoModal();
  88.     if (nResponse == IDOK)
  89.     {
  90.         // TODO: Place code here to handle when the dialog is
  91.         //  dismissed with OK
  92.     }
  93.     else if (nResponse == IDCANCEL)
  94.     {
  95.         // TODO: Place code here to handle when the dialog is
  96.         //  dismissed with Cancel
  97.     }
  98.  
  99.     // Since the dialog has been closed, return FALSE so that we exit the
  100.     //  application, rather than start the application's message pump.
  101.     return FALSE;
  102. }
  103.  
  104. int CGuidGenApp::ExitInstance() 
  105. {
  106.     ::CoUninitialize();
  107.     
  108.     return CWinApp::ExitInstance();
  109. }
  110.